import request from '@/hooks/request'

const Api = {
  addPublicWechatUserRelevancy: '/platform/publicWechat/addPublicWechatUserRelevancy', // 添加公众号用户绑定
  getPublicWechatUserRelevancyList: '/platform/publicWechat/getPublicWechatUserRelevancyList', // 获取已关联的微信列表
  deleteQuotationRule: '/platform/publicWechat/deleteQuotationRule', // 解绑
  verifyRegSms: '/platform/user/verifyRegSms', // 校验验证码
  getQRCodeUrl: '/platform/publicWechat/getQRCodeUrl', // 获取二维码
}

export const addPublicWechatUserRelevancy = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('code', parameter.code)
  return request({
    method: 'post',
    url: Api.addPublicWechatUserRelevancy,
    data: formData,
  })
}

export const getPublicWechatUserRelevancyList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getPublicWechatUserRelevancyList,
    data: parameter,
  })
}

export const deleteQuotationRule = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.deleteQuotationRule,
    data: formData,
  })
}

export const verifyRegSms = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('userName', parameter.userName)
  formData.append('code', parameter.code)
  return request({
    method: 'post',
    url: Api.verifyRegSms,
    data: formData,
  })
}

export const getQRCodeUrl = () => {
  return request({
    method: 'post',
    url: Api.getQRCodeUrl,
  })
}
